<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Search extends LW_Controller {

	protected $assets;
	public function __construct()
	{
		parent::__construct();
		// 初始化样式
		$this->assets = $this->lw_assets->getAssets();
	}

	public function index()
	{
		$data = $this->data;
		$this->assets['pageCss'] = array(base_url('assets/pages/search/css/search.min.css'));
		$this->assets['pageJs'] = array(base_url('assets/pages/search/script/index.js'));
		$data['assets'] = $this->assets;
		$get = $this->input->get();
		$data['pageTitle'] = '搜索';
		if(isset($get['keywords'])&&$get['keywords']){
			$data['pageTitle'] = "搜索 “{$get['keywords']}”";
		}
		$data['searchKeywords'] = isset($get['keywords'])?$get['keywords']:'';
		$this->lw_load->view('search/index',$data);
	}

	public function lists($page)
	{
		$this->load->library('lw_pagination');
		$param = $this->input->post('param');
		$sql = "select * from tb_film_list where has_download=1";
		$hasWhere = true;
		$group = null;
		$order = "id desc";
		$paramFilter = array('name');
		$data = $this->lw_pagination->lists($sql,$param,$page,$hasWhere,$group,$order,$paramFilter);
		echo $this->load->view('search/list',$data,true);
	}
}
